package 进制转换.二进制链表转整数;

public class ejzlbzzs {
    public static void main(String[] args) {
        ListNode head = new ListNode();
        head.val = 1;
        head.next = new ListNode(0,new ListNode(1));

    }
    public static int getDecimalValue(ListNode head) {
        String res = "";
        while(head != null){
            res += head.val;
            head = head.next;
        }
       return Integer.parseInt(res,2);
    }

}
 class ListNode {
   int val;
   ListNode next;
   ListNode() {}
   ListNode(int val) { this.val = val; }
   ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 }